import React, { Suspense } from "react";
import { Outlet,useLocation } from "react-router-dom";
import "./App.scss";
import Tabar from "./components/Tabar/Tabar";
import Menus from "./components/Menu/Menus";
import Crumbs from "./components/crumbs/Crumbs";
import { UseDispatch, useSelector } from "react-redux";
export default function App() {
  // const dispatch = UseDispatch();
  const tabar = useSelector((state: any) => state.tabarVal); //获取tabarVal
  //获取url路径
  const location = useLocation();
  
  
  return (
    <div>
      <Tabar/>
      <div className="fade-in-tr" style={{ display: "flex" }}>
      {/* 点击首页去掉menu */}
       {tabar.name==='首页'||location.pathname==='/app/home'?'': <Menus />}
       {tabar.name==='治理有效' && location.pathname==='app/partyorganizationmanagement'?<Menus />:''}
        <div style={{ width: "100%" }}>
        {tabar.name==='首页'||location.pathname==='/app/home'?'':<Crumbs />}
        {tabar.name==='治理有效' && location.pathname==='app/partyorganizationmanagement'?<Crumbs />:''}
          <Outlet />
        </div>
      </div>
    </div>
  );
}
